package com.treemon.meetingcore.ExtObj
{
	import com.treemon.meetingcore.session.MeetingSession;
	import com.xlib.xml.xmlhelper;
	
	public class MessageObj
	{
		public function MessageObj(aSession: MeetingSession): void
		{
			_session = aSession;
		}
		
		public function createGroupChat(aBody: String): void
		{
			messageType = defGroupChat;
			messageBody = aBody;
		}
		
		public function createPrivateChat(aBody: String): void
		{
			messageType = defPrivateChat;
			messageBody = aBody;
		}
		
		public function toXMLString(): String
		{
			var xmlMessage: XML =
				<message id="" to="513534@slavemcu_1.machine1.com" type="">
					<body></body>
					<x seconds="0" xmlns="jabber:x:expire"/>
				</message>
			xmlMessage.@to = _session.meetingID;
			xmlMessage.@type = messageType;
			xmlMessage.body = messageBody;
			trace(xmlMessage.toString());
			var strXML: String = xmlhelper.getSafeXMLString(xmlMessage);
			trace(strXML);
			return strXML;

		}
		
		private const defGroupChat: String = "groupchat";
		private const defPrivateChat: String = "chat";
		private var _messageType: String = "";
		private var _messageBody: String = "";
		private var _session: MeetingSession = null;
		
		public function set messageType(value: String): void
		{
			_messageType = value;
		}
		
		public function get messageType(): String
		{
			return _messageType;
		}
		
		public function set messageBody(value: String): void
		{
			_messageBody = value;
		}
		
		public function get messageBody(): String
		{
			return _messageBody;
		}

	}
}